FROM alpine:3.15.4
USER root

# To create a non root group and user inside your Alpine based Dockerfile
# -g is the GID
# addgroup -g 1000 groupname
# -u is the UID
# -D permits to create an user without password
# adduser -u 1000 -G groupname -h /home/username -D username

RUN addgroup -g 1000 app \
        && adduser -h /home/app -G app -u 2000 -D app \
	&& mkdir -p /app/logs && mkdir -p /app/3rd && mkdir -p /app/config && chown -R app:app /app && chmod -R 755 /app \
	&& apk update \
        && apk upgrade \
        && apk add --no-cache bash bash-doc bash-completion \
        && /bin/bash \
        && apk add tzdata busybox-extras && /bin/cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
        && echo 'Asia/Shanghai' >/etc/timezone \
	&& rm -rf /var/cache/apk/*
